<html  xmlns:th="http://www.thymeleaf.org">
<head>
    <title>test</title>
    <meta charset="UTF-8">

    <link rel="stylesheet" type="text/css" href="css/index.css">

</head>
<body background="images\44bOOOPICe8.jpg " width="100%" height="100%">


<div align="center"style="width: 360px;margin: 0 auto;
    padding: 29px 30px 53px;background: url(/images/bg-white-lock.png);">

    <form role="form" method="post" th:action="@{/userLogin}" th:object="${user}">
        <div style="margin-bottom: 15px;">
            <td>账号</td>
            <td>
                <input type="text" placeholder="账号" id="name" value=""th:field="*{name}"/></td>
        </div>
        <div style="margin-bottom: 15px;">
            <td>密码</td>
            <td>
                <input type="password" autocomplete="off" placeholder="密码" id="password" value=""/></td>
        </div>
        <!--<div>

                <td>验证码</td>
                <td>
                <input id="aa" name="bb" placeholder="请输入验证码"/>
                <span id="login" onclick="show()"></span>
                <span style="color: red">(验证码区分大小写)</span>
                </td>

        </div>-->
        <div>
            <label>
                <input type="checkbox" name="remember" value="1"/> 记住我
                <span></span>
            </label>
            <button type="submit" class="btn green pull-right"> 登录</button>
        </div>
    </form>
</div>


<script language="javascript">
    function validateLogin() {

        var name = document.getElementById("name").value;
        console.info(name + ":" + "name");
        var password = document.getElementById("password").value;
        console.info(password + ":" + "password");

        return false;
        var a = document.getElementById("login").innerHTML;
        console.info("验证码是：" + a);
        var c = $("input[name='bb']").val();
        console.info("输入码是:" + c);
        if (a !== c) {
            alert("请输入正确的验证码");
            //刷新页面
            /*window.location.reload();*/
            return false;
        }


    }


    //验证码模块开始
    function codes(n) {
        var a = "azxcvbnmsdfghjklqwertyuiopZXCVBNMASDFGHJKLQWERTYUIOP0123456789";
        var b = "";
        for (var i = 0; i < n; i++) {
            var index = Math.floor(Math.random() * 62);
            b += a.charAt(index);
        }
        console.info(b);


        return b;
    };

    function show() {
        document.getElementById("login").innerHTML = codes(4);

    }

    window.onload = show;
    //验证码模块结束

</script>
</body>
</html>